<template>
  <view>
    <!-- stripe type="selection" 开启多选 -->
    <uni-table ref="table" type="" stripe :loading="loading" border emptyText="暂无更多数据" filter-type="search">
        <uni-tr v-for="(item, index) in card_arr" :key="index" >
			<uni-td width="100%" align="left" class="td-class" >
				<div class="td_div">
					<view class="td_list">
						<text class="label">物料：</text>
						<text class="text font-red">{{ item.inv_name }}</text>
					</view>
					<view class="td_list">
						<text class="label">编码：</text>
						<text class="text">{{ item.inv_number }}</text>
					</view>
					<view class="td_list">
						<text class="label">规格：</text>
						<text class="text">{{ item.inv_specification}}</text>
					</view>
					<view class="td_list">
						<text class="label">位置：</text>
						<text class="text">{{ item.shelves_name }}</text>
					</view>
					<view class="td_list" > <!-- v-show="order_type==0||order_type==4?true:false" -->
						<text class="label">批号：</text>
						<text class="text">{{ item.cBatch }}</text>
					</view>
					<!-- <view class="td_list" v-show="order_type==0||order_type==4?true:false">
						<text class="label">入库数：</text>
						<text class="text">{{ item.fauxqty }}</text>
					</view> -->
					<view class="td_list" v-show="order_type==15?true:false">
						<text class="label">退回类型：</text>
						<text class="text">{{ item.b_remark }}</text>
					</view>
					<view class="td_list" v-show="order_type==19?true:false">
						<text class="label">类型：</text>
						<text class="text">{{ item.b_remark }}</text>
					</view>
					<view class="td_list">
						<text class="label">基本数量：</text>
						<text class="text">{{ item.fqty }}</text>
						<text class="label">单位：</text>
						<text class="text">{{ item.inv_unit }}</text>
					</view>
					<view class="td_list">
						<text class="label">常用数量：</text>
						<text class="text">{{ item.fauxqty }}</text>
						<text class="label">单位：</text>
						<text class="text">{{ item.store_unit }}</text>
					</view>
					<view class="td_list">
						<text class="label">流水码：</text>
						<text class="text" style="word-break: break-all;">{{ item.inv_attributes }}</text>
					</view>
				</div>
			</uni-td>
        </uni-tr>
    </uni-table>
    <view class="uni-pagination-box">
		<uni-pagination show-icon :page-size="pageSize" :current="currentPage"
        :total="total" @change="change" />
	</view>
  </view>
</template>

<script>
// 引入uni-ui组件
import {
  uniPagination,
  uniIcons,
  uniCard,
  uniTable,
  uniTr,
  uniTh,
  uniTd,
  uniEasyinput
} from "@dcloudio/uni-ui"

export default {
  data() {
    return {
      card_arr: [],//当前页码的表格数据
      pageSize: 15,// 每页数据量
      currentPage: 1,// 当前页
      total: 0,// 数据总量
      loading: false,
     
	  placeholderStyle:'font-size:16px;',
	  styles:{
	  	borderColor: '#999'
	  },
	  
	  keyword:'',
	  where:' 1=1 ',
	  FBillNo:'',
	  order_type:''
    }
  },
  components: {
    uniPagination,
    uniIcons, //uni-ui的icons组件
    uniCard, //uni-ui的卡片组件
    uniTable,
    uniTr,
    uniTh,
    uniTd,
	uniEasyinput
  },
  mounted(e) {
    this.getlist()
  },
  onLoad(e) {
	  if(e.FBillNo!=undefined){
	  	this.FBillNo = e.FBillNo;
	  }
	  this.order_type = e.order_type
  },
  methods: {
    radioChange(e) {
      var value = Number(e.detail.value);
	  //console.log(value)
      this.id = this.card_arr[value].id
    },
    // 点击关闭的事件回调
    close() {
      uni.navigateBack({})
    },
	// 搜索
	search() {
		this.getlist();
	},
    //获取列表
    getlist() {
		uni.showLoading();
		if(this.FBillNo!=''){
			this.where = "FBillNo = '"+this.FBillNo+"'"
			this.$Db.queryCount('stockbillentry',this.where).then(res => {
				this.total = res[0].num;//获得总页数
			})
			
			this.$Db.queryDataList('stockbillentry',this.currentPage,this.pageSize,this.where).then(res => {
				this.card_arr = res;
				uni.hideLoading();
			})
		}
    },
    change(e) {
      this.currentPage = e.current
      this.getlist()
    }
  }
}
</script>
<style lang="less">
</style>